/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package researchgrants.parts.pi.filters;

import researchgrants.parts.pi.*;

/**
 * Filter out all elements, but the one with the given piId.
 * @author ohad
 */
public class PiFilterFreeText implements PiFilter {

    // the content to search, lower cased
    String freeText;
    
    public PiFilterFreeText(String freeText) {
        this.freeText=freeText.toLowerCase();
    }

    public boolean isFiltered(Pi pi) {
        boolean found=false;

        
        if (pi.getCurrentName().toLowerCase().contains(freeText)) {
            found=true;
        }
        if (pi.getCurrentNotes().toLowerCase().contains(freeText)) {
            found=true;
        }
        if (pi.getCurrentEmail().toLowerCase().contains(freeText)) {
            found=true;
        }
        if (pi.getCurrentTelephone().toLowerCase().contains(freeText)) {
            found=true;
        }
        return(!found);
    }

}
